x86/xstate: Fix latent bugs in compress_xsave_states()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 12 Sep 2016 09:30:00 +0000 (10:30 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 13 Sep 2016 09:44:09 +0000 (10:44 +0100)
commit773522000cc17f6f4323a4d97423790138ea98f2
treea683b8f5e58a7b38041f636df033fa23ca6f2e19
parent681aea049c4a83bb847918003dc2ae21c1156ddb
x86/xstate: Fix latent bugs in compress_xsave_states()

compress_xsave_states() mustn't read xstate_bv or xcomp_bv before first
confirming that the input buffer is large enough.  It also doesn't cope with
compressed input.  Make all of these problems the callers responsbility to
ensure.

Simplify the decompression logic by inlining get_xsave_addr().  As xstate_bv
is previously validated, dest won't ever been NULL.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/xstate.c